import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);

const store=new Vuex.Store({
  state:{
    isLogin: false,
    openid:null,
  },
  mutations:{
    login(state,openid){
      state.isLogin=true;
      state.openid=openid;
    },
    logout(state){
      state.isLogin=false;
    },
    setOpenid(state,openid){
      state.openid=openid;
    },
  },
  actions:{
    getCode: function({commit,state}){
      const code="code";
      commit("getCode",code);
    },
    login:function({commit,state}){
      const openid="123";
      commit("login",openid)
    },
    checkSession: function({commit,state}){
      const session="session";
      commit("checkSession",session);
    }
  }
})